| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | source 'http://rubygems.org' | 
| 2 | -ruby "2.1.6" | |
| 2 | +ruby "2.1.1" | |
| 3 | 3 |  | 
| 4 | 4 | gem 'unicorn' | 
| 5 | 5 | gem 'sinatra' | 
| @@ -56,7 +56,7 @@ class WhoisParser | ||
| 56 | 56 | # Owner | 
| 57 | 57 | owner_data = whois_lookup.to_s.scan(/Registrant\sName:\s([^\\]+)/).first | 
| 58 | 58 | if owner_data != nil | 
| 59 | -        owner_data = spliter(owner_data, "\r").downcase.split.map(&:capitalize).join(' ') | |
| 59 | +        owner_data = spliter(owner_data, "\n").downcase.split.map(&:capitalize).join(' ') | |
| 60 | 60 | if owner_data | 
| 61 | 61 | @parsed_data["owner"] = owner_data | 
| 62 | 62 | end | 
| @@ -4,6 +4,7 @@ require 'haml' | ||
| 4 | 4 | require 'json' | 
| 5 | 5 | require 'ostruct' | 
| 6 | 6 | require "sinatra/reloader" if development? | 
| 7 | + | |
| 7 | 8 | require_relative 'json_parser' | 
| 8 | 9 | require_relative 'unirest_parser' | 
| 9 | 10 |  | 
| @@ -60,8 +61,8 @@ set :views, File.dirname(__FILE__) + '/views' | ||
| 60 | 61 | set :public_folder, File.dirname(__FILE__) + '/public' | 
| 61 | 62 |  | 
| 62 | 63 | get '/' do | 
| 63 | - cache_for_day | |
| 64 | - haml :index | |
| 64 | + #cache_for_day | |
| 65 | +  File.read(File.join('public', 'index.html')) | |
| 65 | 66 | end | 
| 66 | 67 |  | 
| 67 | 68 | get '/lookup' do | 
| @@ -106,7 +107,18 @@ get '/:url' do | ||
| 106 | 107 | 'Access-Control-Allow-Methods' => ['OPTIONS', 'GET', 'POST'] | 
| 107 | 108 | begin | 
| 108 | 109 | #cache_for_day | 
| 109 | - UnirestParser.parse(params[:url]) | |
| 110 | + #UnirestParser.parse(params[:url]) | |
| 111 | + parser = WhoisParser.new | |
| 112 | + if whois_lookup.class != Array | |
| 113 | + data = whois_lookup.to_h | |
| 114 | + else | |
| 115 | + if whois_lookup.first.class != Array | |
| 116 | + data = whois_lookup.first.to_h | |
| 117 | + else | |
| 118 | + data = "" | |
| 119 | + end | |
| 120 | + end | |
| 121 | + parser.parse(data, whois_lookup, params[:url], params[:raw], params[:dev]) | |
| 110 | 122 | rescue Exception => e | 
| 111 | 123 | @error = e | 
| 112 | 124 |      { :error => @error }.to_json | 
| @@ -0,0 +1,5 @@ | ||
| 1 | +/*! | |
| 2 | + * Bootstrap v3.3.4 (http://getbootstrap.com) | |
| 3 | + * Copyright 2011-2015 Twitter, Inc. | |
| 4 | + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |